class Solution {
public:
    bool checkRecord(const string& s) {
        int absent = 0, cons_late = 0;
        bool flag = false;
        for(int i = 0; i < s.length(); i++){
            if(absent >= 2 || flag)return false;
            if(s[i] == 'A'){
                absent++;
            }
            if(s[i] != 'L')cons_late = 0;
            else cons_late++;
            if(cons_late >= 3)flag = true;
        }
        return !(absent >= 2 || flag);
    }
};

/**
 * 2021.8.17
 * 模拟
 */